package com.ljj.bitetime.data.local.doa

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import com.ljj.bitetime.data.local.entity.OrderEntity

@Dao
interface OrderDao {
    @Query("SELECT * FROM orders ORDER BY orderTime DESC")
    suspend fun getAllOrdersSync(): List<OrderEntity>

    @Query("SELECT * FROM orders WHERE id = :id")
    suspend fun getOrderById(id: String): OrderEntity?

    @Insert
    suspend fun insertOrder(order: OrderEntity): Long

    @Query("DELETE FROM orders WHERE id = :id")
    suspend fun deleteOrder(id: String)
}
